Enemy32 = Enemy.extend ({

	init: function(context, imagePath) {

		this._super(context, imagePath);
		this.scale = 0.33;
		this.curentPositionEnemy = [1065, 1035];
		this.firstShootFromEnemy = 1000;
		this.secondShootFromEnemy = 2200;
	},
	
	drawWalkEnemy: function() {
		var self = this;
		var frame = self.frameIndex;
		this.clear(self.curentPositionEnemy[0], self.curentPositionEnemy[1]);
		this.context.save();
		this.context.scale(self.scale, self.scale);
		this.context.drawImage(self.img, ( frame * 100), 0,
								100, 67,
								self.curentPositionEnemy[0], self.curentPositionEnemy[1],
								100, 67);
		this.context.restore();
	},
	
	walkEnemy: function() {
		var self = this;
		self.interval = setInterval(function() {
			self.drawWalkEnemy();
			self.frameIndex ++;
	        if (self.frameIndex >= self.numberOfFrame-1) {	
				clearInterval(self.interval);
				self.drawWalkEnemy();
	        } 
		}, 1000/9);
	},
	drawShooterEnemy: function() {
		var self = this;
		this.clear(self.curentPositionEnemy[0], self.curentPositionEnemy[1]);
		this.context.save();
		this.context.scale(self.scale, self.scale);
		this.context.drawImage(self.img, 500 , 0,
								100, 67,
								self.curentPositionEnemy[0], self.curentPositionEnemy[1],
								100, 67);
		this.context.restore();
	},
	
	drawDeadEnemy: function() {;
		var self = this;	
		var frame = self.frameIndex;
		this.clear(self.curentPositionEnemy[0], self.curentPositionEnemy[1]);
		this.context.save();
		this.context.scale(self.scale, self.scale);
		this.context.drawImage(self.img, ( frame * 100) , 154,
								100, 67,
								self.curentPositionEnemy[0], self.curentPositionEnemy[1],
								100, 67);
		this.context.restore();
	},
	
	clear: function(x, y) {
		this.context.save();
		this.context.scale(this.scale, this.scale);
		this.context.clearRect((x-10), (y-10), 130, 95);
		this.context.restore();
	},
});